#ifndef CPRINTTEST_H
#define CPRINTTEST_H

#include <QObject>
#include <QPrinter>
#include <QTextDocument>
#include <QTextEdit>
#include "CTest.h"
#include "CPrintSettings.h"

class CTest;

class CPrintTest : public QObject
{
    Q_OBJECT
public:
    explicit CPrintTest(QWidget *parent = 0);
    ~CPrintTest();
    void printTest (CTest &test, CPrintSettings &printSettings);
    void printPreviewTest (CTest &test, CPrintSettings &printSettings);
    void printKeys (CTest &test);
    void printComment (CTest &test);

private:
    QWidget *parent;
    QPrinter *printer;
    CTest test;
    CPrintSettings printSettings;

private: //methods

    void questionToTextDocument(QTextDocument * textDoc, const CQuestion &question);
    void _printTest(QTextDocument * textDoc, QPrinter *printer, CPrintSettings &printSettings);
    QTextTableFormat tableFormat();

private slots:
    void printPreview(QPrinter *printer);
};

#endif // CPRINTTEST_H

